<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Inline::C - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Inline-C - MetaCPAN" href="https://metacpan.org/dist/Inline-C/releases.rss" />
        <link rel="canonical" href="./Inline::C.html" />
        <meta name="description" content="C Language Support for Inline" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Inline::C" />
<meta name="twitter:title"       content="Inline::C" />
<meta name="twitter:description" content="" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Inline::C.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Inline-C was released.">
      <span class="relatize">02 Mar 2022 15:39:05 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Inline-C">Inline-C</a>
  </li>
  <li>
    Module version: 0.82
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Inline-C/source/lib/Inline/C.pm">Source</a>
    (<a href="https://metacpan.org/dist/Inline-C/source/lib/Inline/C.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g p" href="https://metacpan.org/dist/Inline-C/source/lib/Inline/C.pod">Pod Source</a>
    (<a href="https://metacpan.org/dist/Inline-C/source/lib/Inline/C.pod?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Inline-C/source/lib/Inline">Browse</a>
    (<a href="https://metacpan.org/dist/Inline-C/source/lib/Inline?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Inline-C/changes">Changes</a>
    </li>
    <li>
      <a rel="noopener nofollow" class="nopopup" href="https://github.com/ingydotnet/inline-c-pm">Homepage</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Inline-C/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/ingydotnet/inline-c-pm">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://github.com/ingydotnet/inline-c-pm/issues">Issues</a>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Inline-C+0.82" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/I/Inline-C.html?oncpan=1&amp;distmat=1&amp;version=0.82&amp;grade=2" style="color: #090">2607</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/I/Inline-C.html?oncpan=1&amp;distmat=1&amp;version=0.82&amp;grade=3" style="color: #900">32</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/I/Inline-C.html?oncpan=1&amp;distmat=1&amp;version=0.82&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/ETJ/Inline-C-0.82">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Inline-C who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 4
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Inline-C-0.82/index.html">72.58% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.8.1
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Inline-C/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/E/ET/ETJ/Inline-C-0.82.tar.gz">
      Download (<span itemprop="fileSize">77.33KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FETJ%2FInline-C-0.82%2Flib%2FInline%2FC.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Inline-C/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Inline-C/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Inline-C">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Inline-C">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Inline/C.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  
  value="ETJ/Inline-C-0.82_001"
>0.82_001 DEV
  (ETJ on 2022-03-10)</option>
<option
  disabled
  value="ETJ/Inline-C-0.82"
>0.82
  (ETJ on 2022-03-02)</option>
<option
  
  value="INGY/Inline-C-0.81_001"
>0.81_001 DEV
  (INGY on 2020-01-12)</option>
<option
  
  value="TINITA/Inline-C-0.81"
>0.81
  (TINITA on 2019-05-11)</option>
<option
  
  value="TINITA/Inline-C-0.80"
>0.80
  (TINITA on 2019-04-18)</option>
<option
  
  value="TINITA/Inline-C-0.78"
>0.78
  (TINITA on 2017-05-30)</option>
<option
  
  value="INGY/Inline-C-0.76"
>0.76
  (INGY on 2015-07-01)</option>
<option
  
  value="INGY/Inline-C-0.75"
>0.75
  (INGY on 2015-03-14)</option>
<optgroup label="BackPAN">'
<option
  
  value="TINITA/Inline-C-0.80_001"
>0.80_001 DEV
  (TINITA on 2019-05-05)</option>
<option
  
  value="TINITA/Inline-C-0.79_003"
>0.79_003 DEV
  (TINITA on 2019-03-29)</option>
<option
  
  value="TINITA/Inline-C-0.79_002"
>0.79_002 DEV
  (TINITA on 2019-01-26)</option>
<option
  
  value="TINITA/Inline-C-0.79_001"
>0.79_001 DEV
  (TINITA on 2019-01-21)</option>
<option
  
  value="TINITA/Inline-C-0.77"
>0.77
  (TINITA on 2017-05-12)</option>
<option
  
  value="INGY/Inline-C-0.74"
>0.74
  (INGY on 2015-02-18)</option>
<option
  
  value="INGY/Inline-C-0.73"
>0.73
  (INGY on 2015-01-02)</option>
<option
  
  value="INGY/Inline-C-0.72"
>0.72
  (INGY on 2015-01-01)</option>
<option
  
  value="INGY/Inline-C-0.71"
>0.71
  (INGY on 2014-12-27)</option>
<option
  
  value="INGY/Inline-C-0.70"
>0.70
  (INGY on 2014-12-27)</option>
<option
  
  value="ETJ/Inline-C-0.69"
>0.69
  (ETJ on 2014-12-26)</option>
<option
  
  value="ETJ/Inline-C-0.68"
>0.68
  (ETJ on 2014-12-24)</option>
<option
  
  value="ETJ/Inline-C-0.67"
>0.67
  (ETJ on 2014-11-25)</option>
<option
  
  value="ETJ/Inline-C-0.66"
>0.66
  (ETJ on 2014-11-17)</option>
<option
  
  value="ETJ/Inline-C-0.65"
>0.65
  (ETJ on 2014-11-04)</option>
<option
  
  value="INGY/Inline-C-0.64"
>0.64
  (INGY on 2014-09-19)</option>
<option
  
  value="INGY/Inline-C-0.62_13"
>0.62_13 DEV
  (INGY on 2014-09-12)</option>
<option
  
  value="INGY/Inline-C-0.62_12"
>0.62_12 DEV
  (INGY on 2014-09-07)</option>
<option
  
  value="INGY/Inline-C-0.62_11"
>0.62_11 DEV
  (INGY on 2014-08-19)</option>
<option
  
  value="INGY/Inline-C-0.62_10"
>0.62_10 DEV
  (INGY on 2014-08-19)</option>
<option
  
  value="INGY/Inline-C-0.62_09"
>0.62_09 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_08"
>0.62_08 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_07"
>0.62_07 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_06"
>0.62_06 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_05"
>0.62_05 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_04"
>0.62_04 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_03"
>0.62_03 DEV
  (INGY on 2014-08-02)</option>
<option
  
  value="INGY/Inline-C-0.62_02"
>0.62_02 DEV
  (INGY on 2014-08-02)</option>
<option
  
  value="ETJ/Inline-C-0.62_01"
>0.62_01 DEV
  (ETJ on 2014-07-29)</option>
<option
  
  value="ETJ/Inline-C-0.62"
>0.62
  (ETJ on 2014-07-21)</option>
<option
  
  value="INGY/Inline-C-0.61"
>0.61
  (INGY on 2014-07-17)</option>
<option
  
  value="INGY/Inline-C-0.60"
>0.60
  (INGY on 2014-07-14)</option>
<option
  
  value="INGY/Inline-C-0.59"
>0.59
  (INGY on 2014-07-12)</option>
<option
  
  value="ETJ/Inline-C-0.58"
>0.58
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.57"
>0.57
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.56_03"
>0.56_03 DEV
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.56_02"
>0.56_02 DEV
  (ETJ on 2014-07-10)</option>
<option
  
  value="ETJ/Inline-C-0.56_01"
>0.56_01 DEV
  (ETJ on 2014-07-10)</option>
<option
  
  value="INGY/Inline-C-0.54"
>0.54
  (INGY on 2014-06-26)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/ETJ/Inline-C-0.82/diff/' + encodeURIComponent(this.value) + '/lib/Inline/C.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  
  value="ETJ/Inline-C-0.82_001"
>0.82_001 DEV
  (ETJ on 2022-03-10)</option>
<option
  disabled
  value="ETJ/Inline-C-0.82"
>0.82
  (ETJ on 2022-03-02)</option>
<option
  
  value="INGY/Inline-C-0.81_001"
>0.81_001 DEV
  (INGY on 2020-01-12)</option>
<option
  
  value="TINITA/Inline-C-0.81"
>0.81
  (TINITA on 2019-05-11)</option>
<option
  
  value="TINITA/Inline-C-0.80"
>0.80
  (TINITA on 2019-04-18)</option>
<option
  
  value="TINITA/Inline-C-0.78"
>0.78
  (TINITA on 2017-05-30)</option>
<option
  
  value="INGY/Inline-C-0.76"
>0.76
  (INGY on 2015-07-01)</option>
<option
  
  value="INGY/Inline-C-0.75"
>0.75
  (INGY on 2015-03-14)</option>
<optgroup label="BackPAN">'
<option
  
  value="TINITA/Inline-C-0.80_001"
>0.80_001 DEV
  (TINITA on 2019-05-05)</option>
<option
  
  value="TINITA/Inline-C-0.79_003"
>0.79_003 DEV
  (TINITA on 2019-03-29)</option>
<option
  
  value="TINITA/Inline-C-0.79_002"
>0.79_002 DEV
  (TINITA on 2019-01-26)</option>
<option
  
  value="TINITA/Inline-C-0.79_001"
>0.79_001 DEV
  (TINITA on 2019-01-21)</option>
<option
  
  value="TINITA/Inline-C-0.77"
>0.77
  (TINITA on 2017-05-12)</option>
<option
  
  value="INGY/Inline-C-0.74"
>0.74
  (INGY on 2015-02-18)</option>
<option
  
  value="INGY/Inline-C-0.73"
>0.73
  (INGY on 2015-01-02)</option>
<option
  
  value="INGY/Inline-C-0.72"
>0.72
  (INGY on 2015-01-01)</option>
<option
  
  value="INGY/Inline-C-0.71"
>0.71
  (INGY on 2014-12-27)</option>
<option
  
  value="INGY/Inline-C-0.70"
>0.70
  (INGY on 2014-12-27)</option>
<option
  
  value="ETJ/Inline-C-0.69"
>0.69
  (ETJ on 2014-12-26)</option>
<option
  
  value="ETJ/Inline-C-0.68"
>0.68
  (ETJ on 2014-12-24)</option>
<option
  
  value="ETJ/Inline-C-0.67"
>0.67
  (ETJ on 2014-11-25)</option>
<option
  
  value="ETJ/Inline-C-0.66"
>0.66
  (ETJ on 2014-11-17)</option>
<option
  
  value="ETJ/Inline-C-0.65"
>0.65
  (ETJ on 2014-11-04)</option>
<option
  
  value="INGY/Inline-C-0.64"
>0.64
  (INGY on 2014-09-19)</option>
<option
  
  value="INGY/Inline-C-0.62_13"
>0.62_13 DEV
  (INGY on 2014-09-12)</option>
<option
  
  value="INGY/Inline-C-0.62_12"
>0.62_12 DEV
  (INGY on 2014-09-07)</option>
<option
  
  value="INGY/Inline-C-0.62_11"
>0.62_11 DEV
  (INGY on 2014-08-19)</option>
<option
  
  value="INGY/Inline-C-0.62_10"
>0.62_10 DEV
  (INGY on 2014-08-19)</option>
<option
  
  value="INGY/Inline-C-0.62_09"
>0.62_09 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_08"
>0.62_08 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_07"
>0.62_07 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_06"
>0.62_06 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_05"
>0.62_05 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_04"
>0.62_04 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_03"
>0.62_03 DEV
  (INGY on 2014-08-02)</option>
<option
  
  value="INGY/Inline-C-0.62_02"
>0.62_02 DEV
  (INGY on 2014-08-02)</option>
<option
  
  value="ETJ/Inline-C-0.62_01"
>0.62_01 DEV
  (ETJ on 2014-07-29)</option>
<option
  
  value="ETJ/Inline-C-0.62"
>0.62
  (ETJ on 2014-07-21)</option>
<option
  
  value="INGY/Inline-C-0.61"
>0.61
  (INGY on 2014-07-17)</option>
<option
  
  value="INGY/Inline-C-0.60"
>0.60
  (INGY on 2014-07-14)</option>
<option
  
  value="INGY/Inline-C-0.59"
>0.59
  (INGY on 2014-07-12)</option>
<option
  
  value="ETJ/Inline-C-0.58"
>0.58
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.57"
>0.57
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.56_03"
>0.56_03 DEV
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.56_02"
>0.56_02 DEV
  (ETJ on 2014-07-10)</option>
<option
  
  value="ETJ/Inline-C-0.56_01"
>0.56_01 DEV
  (ETJ on 2014-07-10)</option>
<option
  
  value="INGY/Inline-C-0.54"
>0.54
  (INGY on 2014-06-26)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/ExtUtils::MakeMaker" title="ExtUtils::MakeMaker" class="ellipsis">ExtUtils::MakeMaker</a></li>
  <li><a href="https://metacpan.org/pod/File::Spec" title="File::Spec" class="ellipsis">File::Spec</a></li>
  <li><a href="https://metacpan.org/pod/Inline" title="Inline" class="ellipsis">Inline</a></li>
  <li><a href="./Parse::RecDescent.html" title="Parse::RecDescent" class="ellipsis">Parse::RecDescent</a></li>
  <li><a href="https://metacpan.org/pod/Pegex" title="Pegex" class="ellipsis">Pegex</a></li>
  <li><i class="ttip" title="dynamic_config enabled">and possibly others</i></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Inline::C/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Inline%3A%3AC">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Inline-C">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/ETJ/Inline-C-0.82/view/lib/Inline/C.pm">This version</a>
    </li>
    <li>
      <a href="./Inline::C.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/EXPLORER"><img src="https://www.gravatar.com/avatar/59530a227a05261e00532456b589e991?d=identicon&amp;s=20" title="EXPLORER" alt="EXPLORER"></a>
<a class="display-all" href="https://metacpan.org/author/KES"><img src="https://www.gravatar.com/avatar/e8530f00b43b4f6a056f8ad4ee52ea47?d=identicon&amp;s=20" title="KES" alt="KES"></a>
<a class="display-all" href="https://metacpan.org/author/ALEXBYK"><img src="https://www.gravatar.com/avatar/3cb4951ad1cb10799b76160a0b599bad?d=identicon&amp;s=20" title="ALEXBYK" alt="ALEXBYK"></a>
<a class="display-all" href="https://metacpan.org/author/DMOL"><img src="https://www.gravatar.com/avatar/78b28a931707c0fa696996adc7702db9?d=identicon&amp;s=20" title="DMOL" alt="DMOL"></a>
<a class="display-all" href="https://metacpan.org/author/NICKL"><img src="https://www.gravatar.com/avatar/46666dab0b20c81e2aa6751470934dca?d=identicon&amp;s=20" title="NICKL" alt="NICKL"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Inline-C/plussers">19 PAUSE users</a>
</div>
<div>
    14 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-cpan-author="INGY"
      data-contrib-email="ingy@cpan.org"
    >
      <a href="https://metacpan.org/author/INGY" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/5c3afdcbdfe9c2aeed790b9b15d4bcef?d=identicon&amp;s=20" />
      Ingy döt Net
      </a>
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/ETJ" class="author-name">Ed J</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Inline/C.pm&#39;" class="">
<option
  
  value="ETJ/Inline-C-0.82_001"
>0.82_001 DEV
  (ETJ on 2022-03-10)</option>
<option
  selected
  value="ETJ/Inline-C-0.82"
>0.82
  (ETJ on 2022-03-02)</option>
<option
  
  value="INGY/Inline-C-0.81_001"
>0.81_001 DEV
  (INGY on 2020-01-12)</option>
<option
  
  value="TINITA/Inline-C-0.81"
>0.81
  (TINITA on 2019-05-11)</option>
<option
  
  value="TINITA/Inline-C-0.80"
>0.80
  (TINITA on 2019-04-18)</option>
<option
  
  value="TINITA/Inline-C-0.78"
>0.78
  (TINITA on 2017-05-30)</option>
<option
  
  value="INGY/Inline-C-0.76"
>0.76
  (INGY on 2015-07-01)</option>
<option
  
  value="INGY/Inline-C-0.75"
>0.75
  (INGY on 2015-03-14)</option>
<optgroup label="BackPAN">'
<option
  
  value="TINITA/Inline-C-0.80_001"
>0.80_001 DEV
  (TINITA on 2019-05-05)</option>
<option
  
  value="TINITA/Inline-C-0.79_003"
>0.79_003 DEV
  (TINITA on 2019-03-29)</option>
<option
  
  value="TINITA/Inline-C-0.79_002"
>0.79_002 DEV
  (TINITA on 2019-01-26)</option>
<option
  
  value="TINITA/Inline-C-0.79_001"
>0.79_001 DEV
  (TINITA on 2019-01-21)</option>
<option
  
  value="TINITA/Inline-C-0.77"
>0.77
  (TINITA on 2017-05-12)</option>
<option
  
  value="INGY/Inline-C-0.74"
>0.74
  (INGY on 2015-02-18)</option>
<option
  
  value="INGY/Inline-C-0.73"
>0.73
  (INGY on 2015-01-02)</option>
<option
  
  value="INGY/Inline-C-0.72"
>0.72
  (INGY on 2015-01-01)</option>
<option
  
  value="INGY/Inline-C-0.71"
>0.71
  (INGY on 2014-12-27)</option>
<option
  
  value="INGY/Inline-C-0.70"
>0.70
  (INGY on 2014-12-27)</option>
<option
  
  value="ETJ/Inline-C-0.69"
>0.69
  (ETJ on 2014-12-26)</option>
<option
  
  value="ETJ/Inline-C-0.68"
>0.68
  (ETJ on 2014-12-24)</option>
<option
  
  value="ETJ/Inline-C-0.67"
>0.67
  (ETJ on 2014-11-25)</option>
<option
  
  value="ETJ/Inline-C-0.66"
>0.66
  (ETJ on 2014-11-17)</option>
<option
  
  value="ETJ/Inline-C-0.65"
>0.65
  (ETJ on 2014-11-04)</option>
<option
  
  value="INGY/Inline-C-0.64"
>0.64
  (INGY on 2014-09-19)</option>
<option
  
  value="INGY/Inline-C-0.62_13"
>0.62_13 DEV
  (INGY on 2014-09-12)</option>
<option
  
  value="INGY/Inline-C-0.62_12"
>0.62_12 DEV
  (INGY on 2014-09-07)</option>
<option
  
  value="INGY/Inline-C-0.62_11"
>0.62_11 DEV
  (INGY on 2014-08-19)</option>
<option
  
  value="INGY/Inline-C-0.62_10"
>0.62_10 DEV
  (INGY on 2014-08-19)</option>
<option
  
  value="INGY/Inline-C-0.62_09"
>0.62_09 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_08"
>0.62_08 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_07"
>0.62_07 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_06"
>0.62_06 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_05"
>0.62_05 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_04"
>0.62_04 DEV
  (INGY on 2014-08-16)</option>
<option
  
  value="INGY/Inline-C-0.62_03"
>0.62_03 DEV
  (INGY on 2014-08-02)</option>
<option
  
  value="INGY/Inline-C-0.62_02"
>0.62_02 DEV
  (INGY on 2014-08-02)</option>
<option
  
  value="ETJ/Inline-C-0.62_01"
>0.62_01 DEV
  (ETJ on 2014-07-29)</option>
<option
  
  value="ETJ/Inline-C-0.62"
>0.62
  (ETJ on 2014-07-21)</option>
<option
  
  value="INGY/Inline-C-0.61"
>0.61
  (INGY on 2014-07-17)</option>
<option
  
  value="INGY/Inline-C-0.60"
>0.60
  (INGY on 2014-07-14)</option>
<option
  
  value="INGY/Inline-C-0.59"
>0.59
  (INGY on 2014-07-12)</option>
<option
  
  value="ETJ/Inline-C-0.58"
>0.58
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.57"
>0.57
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.56_03"
>0.56_03 DEV
  (ETJ on 2014-07-11)</option>
<option
  
  value="ETJ/Inline-C-0.56_02"
>0.56_02 DEV
  (ETJ on 2014-07-10)</option>
<option
  
  value="ETJ/Inline-C-0.56_01"
>0.56_01 DEV
  (ETJ on 2014-07-10)</option>
<option
  
  value="INGY/Inline-C-0.54"
>0.54
  (INGY on 2014-06-26)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Inline-C">Inline-C-0.82</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage two &#10;
          • 43 direct dependents &#10;          • 76 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Inline-C-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Inline-C-0.82">
    <input type="hidden" name="author" value="ETJ">
    <input type="hidden" name="distribution" value="Inline-C">
    <button type="submit" class="favorite highlight"><span>33</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Inline::C.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>33</span> ++</a>
</div>
   / <span>Inline::C</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Inline::C.html#NAME">NAME</a></li>
  <li><a href="./Inline::C.html#VERSION">VERSION</a></li>
  <li><a href="./Inline::C.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Inline::C.html#USAGE">USAGE</a></li>
  <li><a href="./Inline::C.html#FUNCTION-DEFINITIONS">FUNCTION DEFINITIONS</a></li>
  <li><a href="./Inline::C.html#C-CONFIGURATION-OPTIONS">C CONFIGURATION OPTIONS</a></li>
  <li><a href="./Inline::C.html#C-PERL-BINDINGS">C-PERL BINDINGS</a></li>
  <li><a href="./Inline::C.html#THE-INLINE-STACK-MACROS">THE INLINE STACK MACROS</a></li>
  <li><a href="./Inline::C.html#WRITING-C-SUBROUTINES">WRITING C SUBROUTINES</a></li>
  <li><a href="./Inline::C.html#EXAMPLES">EXAMPLES</a>
    <ul>
      <li><a href="./Inline::C.html#Example-%231-Greetings">Example #1 - Greetings</a></li>
      <li><a href="./Inline::C.html#Example-%232-and-Salutations">Example #2 - and Salutations</a></li>
      <li><a href="./Inline::C.html#Example-%233-Fixing-the-problem">Example #3 - Fixing the problem</a></li>
    </ul>
  </li>
  <li><a href="./Inline::C.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Inline::C.html#BUGS-AND-DEFICIENCIES">BUGS AND DEFICIENCIES</a></li>
  <li><a href="./Inline::C.html#AUTHORS">AUTHORS</a></li>
  <li><a href="./Inline::C.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Inline::C - C Language Support for Inline</p>


<a href="https://travis-ci.org/ingydotnet/inline-c-pm"><img alt="inline-c-pm" src="https://travis-ci.org/ingydotnet/inline-c-pm.png" /></a>

<h1 id="VERSION">VERSION</h1>

<p>This document describes <a href="https://metacpan.org/pod/distribution/Inline-C/lib/Inline/C.pod">Inline::C</a> version <b>0.82</b>.</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p><code>Inline::C</code> is a module that allows you to write Perl subroutines in C. Since version 0.30 the Inline module supports multiple programming languages and each language has its own support module. This document describes how to use Inline with the C programming language. It also goes a bit into Perl C internals.</p>

<p>If you want to start working with programming examples right away, check out <a href="https://metacpan.org/pod/distribution/Inline-C/lib/Inline/C/Cookbook.pod">Inline::C::Cookbook</a>. For more information on Inline in general, see <a href="https://metacpan.org/pod/Inline">Inline</a>.</p>

<h1 id="USAGE">USAGE</h1>

<p>You never actually use <code>Inline::C</code> directly. It is just a support module for using <code>Inline.pm</code> with C. So the usage is always:</p>

<pre><code>    use Inline C =&gt; ...;</code></pre>

<p>or</p>

<pre><code>    bind Inline C =&gt; ...;</code></pre>

<h1 id="FUNCTION-DEFINITIONS"><a id="FUNCTION"></a>FUNCTION DEFINITIONS</h1>

<p>The Inline grammar for C recognizes certain function definitions (or signatures) in your C code. If a signature is recognized by Inline, then it will be available in Perl-space. That is, Inline will generate the &quot;glue&quot; necessary to call that function as if it were a Perl subroutine. If the signature is not recognized, Inline will simply ignore it, with no complaints. It will not be available from Perl-space, although it <i>will</i> be available from C-space.</p>

<p>Inline looks for ANSI/prototype style function definitions. They must be of the form:</p>

<pre><code>    return-type function-name ( type-name-pairs ) { ... }</code></pre>

<p>The most common types are: <code>int</code>, <code>long</code>, <code>double</code>, <code>char*</code>, and <code>SV*</code>. But you can use any type for which Inline can find a typemap. Inline uses the <code>typemap</code> file distributed with Perl as the default. You can specify more typemaps with the <code>typemaps</code> configuration option.</p>

<p>A return type of <code>void</code> may also be used. The following are examples of valid function definitions.</p>

<pre><code>    int Foo(double num, char* str) {
    void Foo(double num, char* str) {
    void Foo(SV*, ...) {
    long Foo(int i, int j, ...) {
    SV* Foo(void) { # &#39;void&#39; arg invalid with the ParseRecDescent parser.
                    # Works only with the ParseRegExp parser.
                    # See the section on `using` (below).
    SV* Foo() {  # Alternative to specifying &#39;void&#39; arg. Is valid with
                 # both the ParseRecDescent and ParseRegExp parsers.</code></pre>

<p>The following definitions would not be recognized:</p>

<pre><code>    Foo(int i) {               # no return type
    int Foo(float f) {         # no (default) typemap for float
    int Foo(num, str) double num; char* str; {</code></pre>

<p>Notice that Inline only looks for function <i>definitions</i>, not function <i>prototypes</i>. Definitions are the syntax directly preceding a function body. Also Inline does not scan external files, like headers. Only the code passed to Inline is used to create bindings; although other libraries can linked in, and called from C-space.</p>

<h1 id="C-CONFIGURATION-OPTIONS"><a id="C"></a>C CONFIGURATION OPTIONS</h1>

<p>For information on how to specify Inline configuration options, see <a href="https://metacpan.org/pod/Inline">Inline</a>. This section describes each of the configuration options available for C. Most of the options correspond either to MakeMaker or XS options of the same name. See <a href="https://metacpan.org/pod/ExtUtils::MakeMaker">ExtUtils::MakeMaker</a> and <a href="https://metacpan.org/pod/perlxs">perlxs</a>.</p>

<dl>

<dt id="auto_include"><code>auto_include</code></dt>
<dd>

<p>Specifies extra statements to automatically included. They will be added onto the defaults. A newline char will be automatically added.</p>

<pre><code>    use Inline C =&gt; config =&gt; auto_include =&gt; &#39;#include &quot;yourheader.h&quot;&#39;;</code></pre>

</dd>
<dt id="autowrap"><code>autowrap</code></dt>
<dd>

<p>If you <code>enable =&gt; autowrap</code>, Inline::C will parse function declarations (prototype statements) in your C code. For each declaration it can bind to, it will create a dummy wrapper that will call the real function which may be in an external library. This is a nice convenience for functions that would otherwise just require an empty wrapper function.</p>

<p>This is similar to the base functionality you get from <code>h2xs</code>. It can be very useful for binding to external libraries.</p>

</dd>
<dt id="boot"><code>boot</code></dt>
<dd>

<p>Specifies C code to be executed in the XS <code>BOOT</code> section. Corresponds to the XS parameter.</p>

</dd>
<dt id="cc"><code>cc</code></dt>
<dd>

<p>Specify which compiler to use.</p>

</dd>
<dt id="ccflags"><code>ccflags</code></dt>
<dd>

<p>Specify compiler flags - same as ExtUtils::MakeMaker&#39;s <code>CCFLAGS</code> option. Whatever gets specified here replaces the default <code>$Config{ccflags}</code>. Often, you&#39;ll want to add an extra flag or two without clobbering the default flags in which case you could instead use <code>ccflagsex</code> (see below) or, if Config.pm has already been loaded:</p>

<pre><code>    use Inline C =&gt; Config =&gt; ccflags =&gt; $Config{ccflags} . &quot; -DXTRA -DTOO&quot;;</code></pre>

</dd>
<dt id="ccflagsex"><code>ccflagsex</code></dt>
<dd>

<p>Extend compiler flags. Sets <code>CCFLAGS</code> to $Config{ccflags} followed by a space, followed by the specified value:</p>

<pre><code>    use Inline C =&gt; config =&gt; ccflagsex =&gt; &quot;-DXTRA -DTOO&quot;;</code></pre>

</dd>
<dt id="cppflags"><code>cppflags</code></dt>
<dd>

</dd>
</dl>

<p>Specify preprocessor flags. Passed to <code>cpp</code> C preprocessor by <code>Preprocess()</code> in <a href="https://metacpan.org/pod/Inline::Filters">Inline::Filters</a>.</p>

<pre><code>    use Inline C =&gt; &lt;&lt;&#39;END&#39;,
        CPPFLAGS =&gt; &#39; -DPREPROCESSOR_DEFINE&#39;,
        FILTERS =&gt; &#39;Preprocess&#39;;
    use Inline C =&gt; &lt;&lt;&#39;END&#39;,
        CPPFLAGS =&gt; &#39; -DPREPROCESSOR_DEFINE=4321&#39;,
        FILTERS =&gt; &#39;Preprocess&#39;;</code></pre>

<dl>

<dt id="filters"><code>filters</code></dt>
<dd>

<p>Allows you to specify a list of source code filters. If more than one is requested, be sure to group them with an array ref. The filters can either be subroutine references or names of filters provided by the supplementary Inline::Filters module.</p>

<p>Your source code will be filtered just before it is parsed by Inline. The MD5 fingerprint is generated before filtering. Source code filters can be used to do things like stripping out POD documentation, pre-expanding <code>#include</code> statements or whatever else you please. For example:</p>

<pre><code>    use Inline C =&gt; DATA =&gt;
               filters =&gt; [Strip_POD =&gt; \&amp;MyFilter =&gt; Preprocess ];</code></pre>

<p>Filters are invoked in the order specified. See <a href="https://metacpan.org/pod/Inline::Filters">Inline::Filters</a> for more information.</p>

<p>If a filter is an array reference, it is assumed to be a usage of a filter plug- in named by the first element of that array reference. The rest of the elements of the array reference are used as arguments to the filter. For example, consider a <code>filters</code> parameter like this:</p>

<pre><code>    use Inline C =&gt; DATA =&gt; filters =&gt; [ [ Ragel =&gt; &#39;-G2&#39; ] ];</code></pre>

<p>In order for Inline::C to process this filter, it will attempt to require the module <a href="https://metacpan.org/pod/Inline::Filters::Ragel">Inline::Filters::Ragel</a> and will then call the <code>filter</code> function in that package with the argument <code>&#39;-G2&#39;</code>. This function will return the actual filtering function.</p>

</dd>
<dt id="inc"><code>inc</code></dt>
<dd>

<p>Specifies an include path to use. Corresponds to the MakeMaker parameter. Expects a fully qualified path.</p>

<pre><code>    use Inline C =&gt; config =&gt; inc =&gt; &#39;-I/inc/path&#39;;</code></pre>

</dd>
<dt id="ld"><code>ld</code></dt>
<dd>

<p>Specify which linker to use.</p>

</dd>
<dt id="lddlflags"><code>lddlflags</code></dt>
<dd>

<p>Specify which linker flags to use.</p>

<p>NOTE: These flags will completely override the existing flags, instead of just adding to them. So if you need to use those too, you must respecify them here.</p>

</dd>
<dt id="libs"><code>libs</code></dt>
<dd>

<p>Specifies external libraries that should be linked into your code. Corresponds to the MakeMaker parameter. Provide a fully qualified path with the <code>-L</code> switch if the library is in a location where it won&#39;t be found automatically.</p>

<pre><code>    use Inline C =&gt; config =&gt; libs =&gt; &#39;-lyourlib&#39;;</code></pre>

<p>or</p>

<pre><code>    use Inline C =&gt; config =&gt; libs =&gt; &#39;-L/your/path -lyourlib&#39;;</code></pre>

</dd>
<dt id="make"><code>make</code></dt>
<dd>

<p>Specify the name of the &#39;make&#39; utility to use.</p>

</dd>
<dt id="myextlib"><code>myextlib</code></dt>
<dd>

<p>Specifies a user compiled object that should be linked in. Corresponds to the MakeMaker parameter. Expects a fully qualified path.</p>

<pre><code>    use Inline C =&gt; config =&gt; myextlib =&gt; &#39;/your/path/yourmodule.so&#39;;</code></pre>

</dd>
<dt id="optimize"><code>optimize</code></dt>
<dd>

<p>This controls the MakeMaker <code>OPTIMIZE</code> setting. By setting this value to <code>&#39;-g&#39;</code>, you can turn on debugging support for your Inline extensions. This will allow you to be able to set breakpoints in your C code using a debugger like gdb.</p>

</dd>
<dt id="prefix"><code>prefix</code></dt>
<dd>

<p>Specifies a prefix that will be automatically stripped from C functions when they are bound to Perl. Useful for creating wrappers for shared library API-s, and binding to the original names in Perl. Also useful when names conflict with Perl internals. Corresponds to the XS parameter.</p>

<pre><code>    use Inline C =&gt; config =&gt; prefix =&gt; &#39;ZLIB_&#39;;</code></pre>

</dd>
<dt id="pre_head"><code>pre_head</code></dt>
<dd>

<p>Specifies code that will precede the inclusion of all files specified in <code>auto_include</code> (ie <code>EXTERN.h</code>, <code>perl.h</code>, <code>XSUB.h</code>, <code>INLINE.h</code> and anything else that might have been added to <code>auto_include</code> by the user). If the specified value identifies a file, the contents of that file will be inserted, otherwise the specified value is inserted.</p>

<pre><code>    use Inline C =&gt; config =&gt; pre_head =&gt; $code_or_filename;</code></pre>

</dd>
<dt id="prototype"><code>prototype</code></dt>
<dd>

<p>Corresponds to the XS keyword &#39;PROTOTYPE&#39;. See the perlxs documentation for both &#39;PROTOTYPES&#39; and &#39;PROTOTYPE&#39;. As an example, the following will set the PROTOTYPE of the &#39;foo&#39; function to &#39;$&#39;, and disable prototyping for the &#39;bar&#39; function.</p>

<pre><code>    use Inline C =&gt; config =&gt; prototype =&gt; {foo =&gt; &#39;$&#39;, bar =&gt; &#39;DISABLE&#39;}</code></pre>

</dd>
<dt id="prototypes"><code>prototypes</code></dt>
<dd>

<p>Corresponds to the XS keyword &#39;PROTOTYPES&#39;. Can take only values of &#39;ENABLE&#39; or &#39;DISABLE&#39;. (Contrary to XS, default value is &#39;DISABLE&#39;). See the perlxs documentation for both &#39;PROTOTYPES&#39; and &#39;PROTOTYPE&#39;.</p>

<pre><code>    use Inline C =&gt; config =&gt; prototypes =&gt; &#39;ENABLE&#39;;</code></pre>

</dd>
<dt id="typemaps"><code>typemaps</code></dt>
<dd>

<p>Specifies extra typemap files to use. These types will modify the behaviour of the C parsing. Corresponds to the MakeMaker parameter. Specify either a fully qualified path or a path relative to the cwd (ie relative to what the cwd is at the time the script is loaded).</p>

<pre><code>    use Inline C =&gt; config =&gt; typemaps =&gt; &#39;/your/path/typemap&#39;;</code></pre>

</dd>
<dt id="using"><code>using</code></dt>
<dd>

<p>Specifies which parser to use. The default is <a href="https://metacpan.org/pod/Inline::C::Parser::RecDescent">Inline::C::Parser::RecDescent</a>, which uses the <a href="./Parse::RecDescent.html">Parse::RecDescent</a> module.</p>

<p>The other options are <code>::Parser::Pegex</code> and <code>::Parser::RegExp</code>, which uses the <a href="https://metacpan.org/pod/Inline::C::Parser::Pegex">Inline::C::Parser::Pegex</a> and <a href="https://metacpan.org/pod/Inline::C::Parser::RegExp">Inline::C::Parser::RegExp</a> modules that ship with <a href="https://metacpan.org/pod/distribution/Inline-C/lib/Inline/C.pod">Inline::C</a>.</p>

<pre><code>    use Inline C =&gt; config =&gt; using =&gt; &#39;::Parser::Pegex&#39;;</code></pre>

<p>Note that the following old options are deprecated, but still work at this time:</p>

<ul>

<li><p><code>ParseRecDescent</code></p>

</li>
<li><p><code>ParseRegExp</code></p>

</li>
<li><p><code>ParsePegex</code></p>

</li>
</ul>

</dd>
</dl>

<h1 id="C-PERL-BINDINGS"><a id="C1"></a>C-PERL BINDINGS</h1>

<p>This section describes how the <code>Perl</code> variables get mapped to <code>C</code> variables and back again.</p>

<p>First, you need to know how <code>Perl</code> passes arguments back and forth to subroutines. Basically it uses a stack (also known as the <b>Stack</b>). When a sub is called, all of the parenthesized arguments get expanded into a list of scalars and pushed onto the <b>Stack</b>. The subroutine then pops all of its parameters off of the <b>Stack</b>. When the sub is done, it pushes all of its return values back onto the <b>Stack</b>.</p>

<p>The <b>Stack</b> is an array of scalars known internally as <code>SV</code>&#39;s. The <b>Stack</b> is actually an array of <b>pointers to SV</b> or <code>SV*</code>; therefore every element of the <b>Stack</b> is natively a <code>SV*</code>. For <i>FMTYEWTK</i> about this, read <code>perldoc perlguts</code>.</p>

<p>So back to variable mapping. XS uses a thing known as &quot;typemaps&quot; to turn each <code>SV*</code> into a <code>C</code> type and back again. This is done through various XS macro calls, casts and the Perl API. See <code>perldoc perlapi</code>. XS allows you to define your own typemaps as well for fancier non-standard types such as <code>typedef</code>- ed structs.</p>

<p>Inline uses the default Perl typemap file for its default types. This file is called <code>/usr/local/lib/perl5/5.6.1/ExtUtils/typemap</code>, or something similar, depending on your Perl installation. It has definitions for over 40 types, which are automatically used by Inline. (You should probably browse this file at least once, just to get an idea of the possibilities.)</p>

<p>Inline parses your code for these types and generates the XS code to map them. The most commonly used types are:</p>

<ul>

<li><p><code>int</code></p>

</li>
<li><p><code>long</code></p>

</li>
<li><p><code>double</code></p>

</li>
<li><p><code>char*</code></p>

</li>
<li><p><code>void</code></p>

</li>
<li><p><code>SV*</code></p>

</li>
</ul>

<p>If you need to deal with a type that is not in the defaults, just use the generic <code>SV*</code> type in the function definition. Then inside your code, do the mapping yourself. Alternatively, you can create your own typemap files and specify them using the <code>typemaps</code> configuration option.</p>

<p>A return type of <code>void</code> has a special meaning to Inline. It means that you plan to push the values back onto the <b>Stack</b> yourself. This is what you need to do to return a list of values. If you really don&#39;t want to return anything (the traditional meaning of <code>void</code>) then simply don&#39;t push anything back.</p>

<p>If ellipsis or <code>...</code> is used at the end of an argument list, it means that any number of <code>SV*</code>s may follow. Again you will need to pop the values off of the <code>Stack</code> yourself.</p>

<p>See <a href="./Inline::C.html#EXAMPLES">&quot;EXAMPLES&quot;</a> below.</p>

<h1 id="THE-INLINE-STACK-MACROS"><a id="THE"></a>THE INLINE STACK MACROS</h1>

<p>When you write Inline C, the following lines are automatically prepended to your code (by default):</p>

<pre><code>    #include &quot;EXTERN.h&quot;
    #include &quot;perl.h&quot;
    #include &quot;XSUB.h&quot;
    #include &quot;INLINE.h&quot;</code></pre>

<p>The file <code>INLINE.h</code> defines a set of macros that are useful for handling the Perl Stack from your C functions.</p>

<dl>

<dt id="Inline_Stack_Vars"><code>Inline_Stack_Vars</code></dt>
<dd>

<p>You&#39;ll need to use this one, if you want to use the others. It sets up a few local variables: <code>sp</code>, <code>items</code>, <code>ax</code> and <code>mark</code>, for use by the other macros. It&#39;s not important to know what they do, but I mention them to avoid possible name conflicts.</p>

<p>NOTE: Since this macro declares variables, you&#39;ll need to put it with your other variable declarations at the top of your function. It must come before any executable statements and before any other <code>Inline_Stack</code> macros.</p>

</dd>
<dt id="Inline_Stack_Items"><code>Inline_Stack_Items</code></dt>
<dd>

<p>Returns the number of arguments passed in on the Stack.</p>

</dd>
<dt id="Inline_Stack_Item(i)"><a id="Inline_Stack_Item"></a><a id="Inline_Stack_Item-i"></a><code>Inline_Stack_Item(i)</code></dt>
<dd>

<p>Refers to a particular <code>SV*</code> in the Stack, where <code>i</code> is an index number starting from zero. Can be used to get or set the value.</p>

</dd>
<dt id="Inline_Stack_Reset"><code>Inline_Stack_Reset</code></dt>
<dd>

<p>Use this before pushing anything back onto the Stack. It resets the internal Stack pointer to the beginning of the Stack.</p>

</dd>
<dt id="Inline_Stack_Push(sv)"><a id="Inline_Stack_Push"></a><a id="Inline_Stack_Push-sv"></a><code>Inline_Stack_Push(sv)</code></dt>
<dd>

<p>Push a return value back onto the Stack. The value must be of type <code>SV*</code>.</p>

</dd>
<dt id="Inline_Stack_Done"><code>Inline_Stack_Done</code></dt>
<dd>

<p>After you have pushed all of your return values, you must call this macro.</p>

</dd>
<dt id="Inline_Stack_Return(n)"><a id="Inline_Stack_Return"></a><a id="Inline_Stack_Return-n"></a><code>Inline_Stack_Return(n)</code></dt>
<dd>

<p>Return <code>n</code> items on the Stack.</p>

</dd>
<dt id="Inline_Stack_Void"><code>Inline_Stack_Void</code></dt>
<dd>

<p>A special macro to indicate that you really don&#39;t want to return anything. Same as:</p>

<pre><code>    Inline_Stack_Return(0);</code></pre>

<p>Please note that this macro actually <b>returns</b> from your function.</p>

</dd>
</dl>

<p>Each of these macros is available in 3 different styles to suit your coding tastes. The following macros are equivalent.</p>

<pre><code>    Inline_Stack_Vars
    inline_stack_vars
    INLINE_STACK_VARS</code></pre>

<p>All of this functionality is available through XS macro calls as well. So why duplicate the functionality? There are a few reasons why I decided to offer this set of macros. First, as a convenient way to access the Stack. Second, for consistent, self documenting, non-cryptic coding. Third, for future compatibility. It occurred to me that if a lot of people started using XS macros for their C code, the interface might break under Perl6. By using this set, hopefully I will be able to insure future compatibility of argument handling.</p>

<p>Of course, if you use the rest of the Perl API, your code will most likely break under Perl6. So this is not a 100% guarantee. But since argument handling is the most common interface you&#39;re likely to use, it seemed like a wise thing to do.</p>

<h1 id="WRITING-C-SUBROUTINES"><a id="WRITING"></a>WRITING C SUBROUTINES</h1>

<p>The definitions of your C functions will fall into one of the following four categories. For each category there are special considerations.</p>

<dl>

<dt id="int-Foo(int-arg1,-char*-arg2,-SV*-arg3)-{"><a id="int"></a><a id="int-Foo-int-arg1--char--arg2--SV--arg3"></a><code>int Foo(int arg1, char* arg2, SV* arg3) {</code></dt>
<dd>

<p>This is the simplest case. You have a non <code>void</code> return type and a fixed length argument list. You don&#39;t need to worry about much. All the conversions will happen automatically.</p>

</dd>
<dt id="void-Foo(int-arg1,-char*-arg2,-SV*-arg3)-{"><a id="void"></a><a id="void-Foo-int-arg1--char--arg2--SV--arg3"></a><code>void Foo(int arg1, char* arg2, SV* arg3) {</code></dt>
<dd>

<p>In this category you have a <code>void</code> return type. This means that either you want to return nothing, or that you want to return a list. In the latter case you&#39;ll need to push values onto the <b>Stack</b> yourself. There are a few Inline macros that make this easy. Code something like this:</p>

<pre><code>    int i, max; SV* my_sv[10];
    Inline_Stack_Vars;
    Inline_Stack_Reset;
    for (i = 0; i &lt; max; i++)
      Inline_Stack_Push(my_sv[i]);
    Inline_Stack_Done;</code></pre>

<p>After resetting the Stack pointer, this code pushes a series of return values. At the end it uses <code>Inline_Stack_Done</code> to mark the end of the return stack.</p>

<p>If you really want to return nothing, then don&#39;t use the <code>Inline_Stack_</code> macros. If you must use them, then set use <code>Inline_Stack_Void</code> at the end of your function.</p>

</dd>
<dt id="char*-Foo(SV*-arg1,-...)-{"><a id="char"></a><a id="char--Foo-SV--arg1"></a><code>char* Foo(SV* arg1, ...) {</code></dt>
<dd>

<p>In this category you have an unfixed number of arguments. This means that you&#39;ll have to pop values off the <b>Stack</b> yourself. Do it like this:</p>

<pre><code>    int i;
    Inline_Stack_Vars;
    for (i = 0; i &lt; Inline_Stack_Items; i++)
      handle_sv(Inline_Stack_Item(i));</code></pre>

<p>The return type of <code>Inline_Stack_Item(i)</code> is <code>SV*</code>.</p>

</dd>
<dt id="void*-Foo(SV*-arg1,-...)-{"><a id="void1"></a><a id="void--Foo-SV--arg1"></a><code>void* Foo(SV* arg1, ...) {</code></dt>
<dd>

<p>In this category you have both a <code>void</code> return type and an unfixed number of arguments. Just combine the techniques from Categories 3 and 4.</p>

</dd>
</dl>

<h1 id="EXAMPLES">EXAMPLES</h1>

<p>Here are a few examples. Each one is a complete program that you can try running yourself. For many more examples see <a href="https://metacpan.org/pod/distribution/Inline-C/lib/Inline/C/Cookbook.pod">Inline::C::Cookbook</a>.</p>

<h2 id="Example-#1-Greetings"><a id="Example"></a><a id="Example--1-Greetings"></a>Example #1 - Greetings</h2>

<p>This example will take one string argument (a name) and print a greeting. The function is called with a string and with a number. In the second case the number is forced to a string.</p>

<p>Notice that you do not need to <code>#include &lt;stdio.h</code>&gt;. The <code>perl.h</code> header file which gets included by default, automatically loads the standard C header files for you.</p>

<pre><code>    use Inline &#39;C&#39;;
    greet(&#39;Ingy&#39;);
    greet(42);
    __END__
    __C__
    void greet(char* name) {
      printf(&quot;Hello %s!\n&quot;, name);
    }</code></pre>

<h2 id="Example-#2-and-Salutations"><a id="Example1"></a><a id="Example--2-and-Salutations"></a>Example #2 - and Salutations</h2>

<p>This is similar to the last example except that the name is passed in as a <code>SV*</code> (pointer to Scalar Value) rather than a string (<code>char*</code>). That means we need to convert the <code>SV</code> to a string ourselves. This is accomplished using the <code>SvPVX</code> function which is part of the <code>Perl</code> internal API. See <code>perldocperlapi</code> for more info.</p>

<p>One problem is that <code>SvPVX</code> doesn&#39;t automatically convert strings to numbers, so we get a little surprise when we try to greet <code>42</code>. The program segfaults, a common occurrence when delving into the guts of Perl.</p>

<pre><code>    use Inline &#39;C&#39;;
    greet(&#39;Ingy&#39;);
    greet(42);
    __END__
    __C__
    void greet(SV* sv_name) {
      printf(&quot;Hello %s!\n&quot;, SvPVX(sv_name));
    }</code></pre>

<h2 id="Example-#3-Fixing-the-problem"><a id="Example2"></a><a id="Example--3-Fixing-the-problem"></a>Example #3 - Fixing the problem</h2>

<p>We can fix the problem in Example #2 by using the <code>SvPV</code> function instead. This function will stringify the <code>SV</code> if it does not contain a string. <code>SvPV</code> returns the length of the string as it&#39;s second parameter. Since we don&#39;t care about the length, we can just put <code>PL_na</code> there, which is a special variable designed for that purpose.</p>

<pre><code>    use Inline &#39;C&#39;;
    greet(&#39;Ingy&#39;);
    greet(42);
    __END__
    __C__
    void greet(SV* sv_name) {
      printf(&quot;Hello %s!\n&quot;, SvPV(sv_name, PL_na));
    }</code></pre>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p>For general information about Inline see <a href="https://metacpan.org/pod/Inline">Inline</a>.</p>

<p>For sample programs using Inline with C see <a href="https://metacpan.org/pod/distribution/Inline-C/lib/Inline/C/Cookbook.pod">Inline::C::Cookbook</a>.</p>

<p>For information on supported languages and platforms see <a href="https://metacpan.org/pod/Inline-Support">Inline-Support</a>.</p>

<p>For information on writing your own Inline Language Support Module, see <a href="https://metacpan.org/pod/Inline-API">Inline-API</a>.</p>

<p>Inline&#39;s mailing list is inline@perl.org</p>

<p>To subscribe, send email to inline-subscribe@perl.org</p>

<h1 id="BUGS-AND-DEFICIENCIES"><a id="BUGS"></a>BUGS AND DEFICIENCIES</h1>

<p>If you use C function names that happen to be used internally by Perl, you will get a load error at run time. There is currently no functionality to prevent this or to warn you. For now, a list of Perl&#39;s internal symbols is packaged in the Inline module distribution under the filename <code>&#39;symbols.perl&#39;</code>. Avoid using these in your code.</p>

<h1 id="AUTHORS">AUTHORS</h1>

<p>Ingy d&ouml;t Net &lt;ingy@cpan.org&gt;</p>

<p>Sisyphus &lt;sisyphus@cpan.org&gt;</p>

<h1 id="COPYRIGHT-AND-LICENSE"><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>Copyright 2000-2022. Ingy d&ouml;t Net.</p>

<p>Copyright 2008, 2010-2014. Sisyphus.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <a href="http://www.perl.com/perl/misc/Artistic.html">http://www.perl.com/perl/misc/Artistic.html</a></p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Inline::C, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Inline::C</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Inline::C</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Inline::C.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
